home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / Panner.C < prev    next >
C/C++ Source or Header  |  1992-04-27  |  1KB  |  69 lines

  1. #ifdef __GNUG__
  2. #pragma implementation
  3. #endif
  4.  
  5. #include "Panner.h"
  6.  
  7. #include "Class.h"
  8. #include "Clipper.h"
  9.  
  10. //---- Panner ------------------------------------------------------------------
  11.  
  12. Panner::Panner(Clipper *mc, Point extent) : Slider(5555, eVert)
  13. {
  14.     cl= mc;
  15.     if (cl)
  16.     cl->AddObserver(this);
  17.     contentRect.extent= extent;
  18.     if (extent.x >= 0)
  19.     SetFlag(eVObjHFixed);
  20.     if (extent.y >= 0)
  21.     SetFlag(eVObjVFixed);
  22. }
  23.  
  24. Panner::~Panner()
  25. {
  26.     if (cl)
  27.     cl->RemoveObserver(this);
  28. }
  29.  
  30. Metric Panner::GetMinSize()
  31. {
  32.     return Metric(40, 40); 
  33. }
  34.  
  35. void Panner::Control(int id, int part, void *val)
  36. {
  37.     if (id == 5555) {
  38.     if (part == eSliderThumb && cl)
  39.         cl->Scroll(cPartScrollAbs, *((Point*)val));
  40.     } else
  41.     Slider::Control(id, part, val);
  42. }
  43.  
  44. void Panner::DoObserve(int, int part, void *vp, Object *op)
  45. {
  46.     if (op == cl) {
  47.     switch (part) {
  48.     case cPartExtentChanged:
  49.         SetThumbRange(*((Point*)vp));
  50.         break;
  51.         
  52.     case cPartScrollPos:
  53.         SetVal(*((Point*)vp), TRUE);
  54.         Update();
  55.         break;
  56.         
  57.     case cPartViewSize:
  58.         SetMax(*((Point*)vp));
  59.         Update();
  60.         break;
  61.         
  62.     case cPartSenderDied:
  63.         cl= 0;
  64.         break;
  65.     }
  66.     }
  67. }
  68.  
  69.